package org.ainlolcat.ainscience.conflictResolver;

import org.ainlolcat.ainscience.UI.ConflictResolver;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: ain
 * Date: 10/29/11
 * Time: 10:28 PM
 * To change this template use File | Settings | File Templates.
 */
public class ListConflict implements Conflict {
    public List<String> oldname;
    public String newname;
    public String message;

    private boolean resolved;

    public ListConflict(List<String> oldName, String message){
        this.oldname = oldName;
        this.message = message;
    }

    public List<String> getOldname() {
        return oldname;
    }

    public String getNewname() {
        return newname;
    }

    public void setNewname(String newname) {
        this.newname = newname;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean tryResolve(String newname){
        if (!oldname.contains(newname)){
            this.newname = newname;
            resolved = true;
            return true;
        }
        else return false;
    }

    public boolean isResolved(){
        return resolved;
    }

    public Object getOldValue() {
        return oldname;
    }

    public Object getNewValue() {
        return newname;
    }

    public int getType(){
        return ConflictResolver.LIST_TYPE;
    }
}
